#pragma once

#ifndef _CSPELL_H_
#define _CSPELL_H_


class CSpell
{
private:
	
	char			m_spellName[50];
	unsigned short	m_spellID;
	unsigned short	m_mpCost;
	double			m_recastTime;
	double			m_castTime;
	unsigned short  m_magicGroup;
	unsigned short  m_spellType;
	unsigned short  m_spellMsg;
	unsigned short  m_defaultMsg;
	unsigned short  m_animID;
	unsigned short  m_allowedTargets;	 //bitmask
	unsigned char	m_spellSkill;
	unsigned short  m_range;			 //1 = singletarget, 2 = aoe
	unsigned short  m_currentTargetNum;
	struct position m_castOrigin;


	CBaseEntity *	m_pCaster;
	CBaseEntity *	m_pMainTarget;
	unsigned int	m_targetID;

	unsigned short	m_element;

public:

	CSpell(unsigned short spellID);
	~CSpell(void);

	std::vector<CBaseEntity*> m_targetList;

	CBaseEntity *	CSpell::getMainTarget();
	double			CSpell::getCastTime();
	double			CSpell::getRecastTime();
	unsigned short	CSpell::getMPCost();
	unsigned short	CSpell::getElement();
	char *			CSpell::getSpellName();
	unsigned short	CSpell::getSpellID();
	unsigned short	CSpell::getSpellAnimID();
	unsigned short	CSpell::getSpellType();
	unsigned short  CSpell::getAllowedTargets();
	unsigned int	CSpell::getSpellDefaultMsgType();
	unsigned int	CSpell::getSpellTargetID();
	unsigned short	CSpell::getCurrentTargetNum();
	CBaseEntity *	CSpell::getCaster();
	struct position CSpell::getCastOrigin();
	unsigned char	CSpell::getSpellSkill();

	bool			CSpell::isTeleportSpell();
	bool			CSpell::isAOESpell();
	bool			CSpell::isValidTarget(CBaseEntity * pTarget);

	void			CSpell::setSpellTargetID(unsigned int targetID);
	void			CSpell::setCaster(CBaseEntity * pCaster);
	void			CSpell::setMainTarget(CBaseEntity * pTarget);
	void			CSpell::setCastOrigin(struct position p);
	void			CSpell::setSpellDefaultMsgType(unsigned int msgID);
	void			CSpell::setCurrentTargetNum(unsigned short ctn);

	void			CSpell::addTarget(CBaseEntity * pTarget);

	void			CSpell::interrupt();

	void			CSpell::startCast();

	void            CSpell::setAnimation(unsigned short animation);

};
#endif
